
zh = open('../chinese.ass', 'r', encoding='utf-8')
en = open('../english.srt', 'r', encoding='utf-8')

zh = zh.read()
en = en.read()

zh = zh.split('\n')
arr_zh = []
for i in zh:
    if ',,' in i:
        i = i[i.rindex(',,') + 2:]
        arr_zh.append(i)
print(arr_zh)

en = en.split('\n\n')
arr_en = []
for i in en:
    i = i.split('\n')
    if len(i) != 3:
        continue
    arr_en.append(i[2])

print(len(arr_en), len(arr_zh))

zh_s = open('../zh.txt', 'w', encoding='utf-8')
en_s = open('../en.txt', 'w', encoding='utf-8')

zh_s.write('\n'.join(arr_zh))
en_s.write('\n'.join(arr_en))
zh_s.flush()
en_s.flush()